#include <shadesmar/pubsub/publisher.h>
#include <stdio.h>
#include <sys/time.h>

typedef struct img_data 
{
    int index;
    int size;
    // long int time;
    unsigned char  data[1920*1080*3];
};

int count = 0;

int main() 
{
    shm::pubsub::Publisher pub("topic_name");
    const uint32_t data_size = 1024;
    void *data = malloc(data_size);

    img_data img = { 0 };
    
    // for (int i = 0; i < 1000; ++i) 
    while (1)
    {
        /* code */
        img.index = count++;
        printf("count:%d\n ", count);
        img.size = 1920*1080*3;

        struct timeval begin;
        gettimeofday(&begin,NULL);
        long long beginTime = (long long)begin.tv_sec * 1000 + (long long)begin.tv_usec / 1000;
        printf("%ld \n", beginTime);

        // img.time = beginTime;

        pub.publish(&img, sizeof(img));
        usleep(30000);
    }
    
}